/** for Color */
import java.awt.Color;

/** for Dimension */
import java.awt.Dimension;

/** for Font */
import java.awt.Font;

/** for JLabel */
import javax.swing.JLabel;

/** for JPanel */
import javax.swing.JPanel;

/**
 * This is a class for Info panel in JPanel
 * @author Code traders
 * @version 1.0
 */
public class InfoPanel extends JPanel implements MainPanel {
	
	/**
	 * serialVersionUID for the InfoPanel
	 */
	private static final long serialVersionUID = -3305718927638432287L;
	
	/**
	 * current player
	 */
	private final Player player;
	
	/**
	 * current planet
	 */
	private final Planet planet;
	
	/**
	 * current ship
	 */
	private final Ship ship;
	
	/**
	 * Width and height for the JPanel
	 */
	private static final int WIDTH = 640, HEIGHT = 252;
	
	/** for 16 **/
	private static final int SIXTEEN = 16;
	
	/** for 315 **/
	private static final int T_HUNDRED_O_F = 315;
	
	/** for 19 **/
	private static final int NINETEEN = 19;
	
	/** for 102 **/
	private static final int O_HUNDRED_T = 102;
	
	/** for 313 **/
	private static final int T_HUNDRED_O_T = 313;
	
	/** for 112 **/
	private static final int O_HUNDRED_O_T = 112;
	
	/** for 80 **/
	private static final int EIGHTY = 80;
	
	/** for 255 **/
	private static final int T_HUNDRED_F_F = 255;
	
	/** for 69 **/
	private static final int SIXTYNINE = 69;
	
	/** for 107 **/
	private static final int O_HUNDRED_S = 107;
	
	/** for 50 **/
	private static final int FIFTY = 50;
	
	/** for 44 **/
	private static final int FORTYFOUR = 44;
	
	/** for 81**/
	private static final int EIGHTYONE = 81;
	
	/** for 60**/
	private static final int SIXTY = 60;
	
	/** for 46**/
	private static final int FORTYSIX = 46;
	
	/** for 78**/
	private static final int SEVENTYEIGHT = 78;
	
	/** for 27**/
	private static final int TWENTYSEVEN = 27;

	/** for  92**/
	private static final int NINETYTWO = 92;
	
	/** for  143**/
	private static final int O_HUNDRED_F_T = 143;
	
	/** for  205**/
	private static final int T_HUNDRED_F = 205;
	
	/** for  56**/
	private static final int FIFTYSIX = 56;
	
	/** for  174**/
	private static final int O_HUNDRED_S_F = 174;
	
	/** for  141**/
	private static final int O_HUNDRED_F_O = 141;
	
	/** for  186**/
	private static final int O_HUNDRED_E_S = 186;
	
	/** for  21**/
	private static final int TWENTYONE = 21;
	
	/** for 122**/
	private static final int O_HUNDRED_T_T = 122;
	
	/** for  17**/
	private static final int SEVENTEEN = 17;
	
	/** for 125**/
	private static final int O_HUNDRED_T_F = 125;
	
	/** for 52**/
	private static final int FIFTYTWO = 52;
	
	/** for 146**/
	private static final int O_HUNDRED_F_S = 146;
	
	/** for 149**/
	private static final int O_HUNDRED_F_N = 149;
	
	/** for 83**/
	private static final int EIGHTYTHREE = 83;
	
	/** for 61**/
	private static final int SIXTYONE = 61;
	
	/** for 137**/
	private static final int O_HUNDRED_T_S = 137;
	
	/** for 114**/
	private static final int O_HUNDRED_O_F = 114;
	
	/** for 159**/
	private static final int O_HUNDRED_F_NINE = 159;
	
	/** for 145**/
	private static final int O_HUNDRED_F_F = 145;
	
	/** for 210**/
	private static final int T_HUNDRED_T = 210;
	
	/** for 176**/
	private static final int O_HUNDRED_S_S = 176;
	
	/** for 207**/
	private static final int T_HUNDRED_S = 207;
	
	/** for 134**/
	private static final int O_HUNDRED_T_FOUR = 134;
	
	/** for 429**/
	private static final int F_HUNDRED_T_N = 429;
	
	/** for 397**/
	private static final int T_HUNDRED_N_S = 397;
	
	/** for 173**/
	private static final int O_HUNDRED_S_T = 173;
	
	/** for 419**/
	private static final int F_HUNDRED_O_N = 419;
	
	/** for 132**/
	private static final int O_HUNDRED_THREE_T = 132;
	
	/**
	 * JLabels on the info panel
	 */
	private final JLabel player_name, pilot_ab, fighter_ab,
	trader_ab, engineer_ab, info_money, info_C_loca,
	info_planet_name, info_planet_location,
	info_planet_tech, info_planet_reso;
	
	/**
	 * Create the panel.
	 */
	public InfoPanel() {
		super.setForeground(Color.WHITE);
		super.setPreferredSize(new Dimension(WIDTH, HEIGHT));
		
		super.setOpaque(false);
		super.setLayout(null);
		
		final JLabel info_Planet = new JLabel("Planet Name:");
		info_Planet.setForeground(Color.WHITE);
		info_Planet.setFont(new Font("Palatino Linotype", Font.BOLD, SIXTEEN));
		info_Planet.setBounds(T_HUNDRED_O_F, NINETEEN, O_HUNDRED_T, NINETEEN);
		super.add(info_Planet);
		
		final JLabel info_Resource = new JLabel("Resource: ");
		info_Resource.setForeground(Color.WHITE);
		info_Resource.setFont(new Font("Palatino Linotype", Font.BOLD, SIXTEEN));
		info_Resource.setBounds(T_HUNDRED_O_T, O_HUNDRED_O_T, EIGHTY, NINETEEN);
		super.add(info_Resource);
		
		final JLabel info_PlayerName = new JLabel("Player Name: ");
		info_PlayerName.setFont(new Font("Palatino Linotype", Font.BOLD, SIXTEEN));
		info_PlayerName.setForeground
		(new Color(T_HUNDRED_F_F, T_HUNDRED_F_F, T_HUNDRED_F_F));
		info_PlayerName.setBounds(SIXTYNINE, NINETEEN, O_HUNDRED_S, NINETEEN);
		super.add(info_PlayerName);
		
		final JLabel info_Pilot = new JLabel("Pilot: ");
		info_Pilot.setFont(new Font("Palatino Linotype", Font.BOLD, SIXTEEN));
		info_Pilot.setForeground(new Color(T_HUNDRED_F_F, T_HUNDRED_F_F, T_HUNDRED_F_F));
		info_Pilot.setBounds(SIXTYNINE, FIFTY, FORTYFOUR, NINETEEN);
		super.add(info_Pilot);
		
		final JLabel info_Fighter = new JLabel("Fighter:");
		info_Fighter.setFont(new Font("Palatino Linotype", Font.BOLD, SIXTEEN));
		info_Fighter.setForeground
		(new Color(T_HUNDRED_F_F, T_HUNDRED_F_F, T_HUNDRED_F_F));
		info_Fighter.setBounds(SIXTYNINE, EIGHTYONE, SIXTY, NINETEEN);
		super.add(info_Fighter);
		
		final JLabel info_Location = new JLabel("Location: ");
		info_Location.setForeground(Color.WHITE);
		info_Location.setFont(new Font("Palatino Linotype", Font.BOLD, SIXTEEN));
		info_Location.setBounds(T_HUNDRED_O_F, FORTYSIX, SEVENTYEIGHT, TWENTYSEVEN);
		super.add(info_Location);
		
		final JLabel info_TechLevel = new JLabel("Tech Level: ");
		info_TechLevel.setForeground(Color.WHITE);
		info_TechLevel.setFont(new Font("Palatino Linotype", Font.BOLD, SIXTEEN));
		info_TechLevel.setBounds(T_HUNDRED_O_F, EIGHTYONE, NINETYTWO, NINETEEN);
		super.add(info_TechLevel);
		
		final JLabel info_Trader = new JLabel("Trader:");
		info_Trader.setFont(new Font("Palatino Linotype", Font.BOLD, SIXTEEN));
		info_Trader.setForeground(new Color(T_HUNDRED_F_F, T_HUNDRED_F_F, T_HUNDRED_F_F));
		info_Trader.setBounds(SIXTYNINE, O_HUNDRED_O_T, FIFTYSIX, NINETEEN);
		super.add(info_Trader);
		
		final JLabel info_Engineer = new JLabel("Engineer: ");
		info_Engineer.setFont(new Font("Palatino Linotype", Font.BOLD, SIXTEEN));
		info_Engineer.setForeground
		(new Color(T_HUNDRED_F_F, T_HUNDRED_F_F, T_HUNDRED_F_F));
		info_Engineer.setBounds(SIXTYNINE, O_HUNDRED_F_T, SEVENTYEIGHT, NINETEEN);
		super.add(info_Engineer);
		
		final JLabel info_Money = new JLabel("Money:");
		info_Money.setFont(new Font("Palatino Linotype", Font.BOLD, SIXTEEN));
		info_Money.setForeground(new Color(T_HUNDRED_F_F, T_HUNDRED_F_F, T_HUNDRED_F_F));
		info_Money.setBounds(SIXTYNINE, T_HUNDRED_F, FIFTYSIX, NINETEEN);
		super.add(info_Money);
		
		final JLabel info_CurrentLocation = new JLabel("Current Location: ");
		info_CurrentLocation.setFont(new Font("Palatino Linotype", Font.BOLD, SIXTEEN));
		info_CurrentLocation.setForeground
		(new Color(T_HUNDRED_F_F, T_HUNDRED_F_F, T_HUNDRED_F_F));
		info_CurrentLocation.setBounds(SIXTYNINE, O_HUNDRED_S_F, O_HUNDRED_F_O, NINETEEN);
		super.add(info_CurrentLocation);
		
		player_name = new JLabel("");
		player_name.setForeground(Color.WHITE);
		player_name.setFont(new Font("Palatino Linotype", Font.BOLD, SIXTEEN));
		player_name.setBounds(O_HUNDRED_E_S, TWENTYONE, O_HUNDRED_T_T, SEVENTEEN);
		super.add(player_name);
		
		pilot_ab = new JLabel("");
		pilot_ab.setForeground(Color.WHITE);
		pilot_ab.setFont(new Font("Palatino Linotype", Font.BOLD, SIXTEEN));
		pilot_ab.setBounds(O_HUNDRED_T_F, FIFTYTWO, O_HUNDRED_F_S, SIXTEEN);
		super.add(pilot_ab);
		
		fighter_ab = new JLabel("");
		fighter_ab.setForeground(Color.WHITE);
		fighter_ab.setFont(new Font("Palatino Linotype", Font.BOLD, SIXTEEN));
		fighter_ab.setBounds(O_HUNDRED_F_N, EIGHTYTHREE, SIXTYONE, SIXTEEN);
		super.add(fighter_ab);
		
		trader_ab = new JLabel("");
		trader_ab.setForeground(Color.WHITE);
		trader_ab.setFont(new Font("Palatino Linotype", Font.BOLD, SIXTEEN));
		trader_ab.setBounds(O_HUNDRED_T_S, O_HUNDRED_O_F, SIXTYONE, SIXTEEN);
		super.add(trader_ab);
		
		engineer_ab = new JLabel("");
		engineer_ab.setForeground(Color.WHITE);
		engineer_ab.setFont(new Font("Palatino Linotype", Font.BOLD, SIXTEEN));
		engineer_ab.setBounds(O_HUNDRED_F_NINE, O_HUNDRED_F_F, SIXTYONE, SIXTEEN);
		super.add(engineer_ab);
		
		info_C_loca = new JLabel("");
		info_C_loca.setForeground(Color.WHITE);
		info_C_loca.setFont(new Font("Palatino Linotype", Font.BOLD, SIXTEEN));
		info_C_loca.setBounds(T_HUNDRED_T, O_HUNDRED_S_S, O_HUNDRED_F_O, SIXTEEN);
		super.add(info_C_loca);
		
		info_money = new JLabel("");
		info_money.setForeground(Color.WHITE);
		info_money.setFont(new Font("Palatino Linotype", Font.BOLD, SIXTEEN));
		info_money.setBounds(O_HUNDRED_T_S, T_HUNDRED_S, O_HUNDRED_T_FOUR, SIXTEEN);
		super.add(info_money);
		
		info_planet_name = new JLabel("");
		info_planet_name.setForeground(Color.WHITE);
		info_planet_name.setFont(new Font("Palatino Linotype", Font.BOLD, SIXTEEN));
		info_planet_name.setBounds(F_HUNDRED_T_N, TWENTYONE, O_HUNDRED_F_O, SIXTEEN);
		super.add(info_planet_name);
		
		info_planet_location = new JLabel("");
		info_planet_location.setForeground(Color.WHITE);
		info_planet_location.setFont(new Font("Palatino Linotype", Font.BOLD, SIXTEEN));
		info_planet_location.setBounds(T_HUNDRED_N_S, FIFTYTWO, O_HUNDRED_S_T, SIXTEEN);
		super.add(info_planet_location);
		
		info_planet_tech = new JLabel("");
		info_planet_tech.setForeground(Color.WHITE);
		info_planet_tech.setFont(new Font("Palatino Linotype", Font.BOLD, SIXTEEN));
		info_planet_tech.setBounds(F_HUNDRED_O_N, EIGHTYTHREE, O_HUNDRED_T_T, SIXTEEN);
		super.add(info_planet_tech);
		
		info_planet_reso = new JLabel("");
		info_planet_reso.setForeground(Color.WHITE);
		info_planet_reso.setFont(new Font("Palatino Linotype", Font.BOLD, SIXTEEN));
		info_planet_reso.setBounds
		(T_HUNDRED_N_S, O_HUNDRED_O_F, O_HUNDRED_THREE_T, SIXTEEN);
		super.add(info_planet_reso);
		
		/** Singleton **/
		this.player = (Player) Singleton.INSTANCE.getInstance().get("player");
		this.ship = (Ship) Singleton.INSTANCE.getInstance().get("ship");
		this.planet = ship.getCurrentPlanet();
		/** Singleton **/
	}

	/**
	 * to update
	 */
	public void update() {
		info_planet_name.setText(planet.getName());
		info_planet_reso.setText("" + planet.getResource());
		info_planet_tech.setText("" + planet.getTechLevel());
		info_planet_location.setText("(" + planet.getPoint().getX()
				+ ", " + planet.getPoint().getY() + ")");
		info_C_loca.setText("(" + planet.getPoint().getX() +
				", " + planet.getPoint().getY() + ")");
		info_money.setText("" + ship.getMoney());
		player_name.setText(player.getName());
		pilot_ab.setText("" + player.getPilot());
		fighter_ab.setText("" + player.getFighter());
		trader_ab.setText("" + player.getTrader());
		engineer_ab.setText("" + player.getEngineer());
		
	}
}
